Instead of using the Dim statement to declare a Report Variable, you declare it by invoking the new AddReportVariable method when the Report Initialize event fires. This method requires you to supply a data type and variable name as parameters. For example:
Me.AddReportVariable crRVCurrency, "Total"
Note: Make certain you enclose the name of the variable in double quotes.
Once you have declared the variable, you can get its value using the GetReportVariableValue method that is part of the Report object. You can set or increment the variable using the SetReportVariableValue method. For example:
Me.SetReportVariableValue "Total", Me.Field3.Value + Me.GetReportVariableValue("Total")
Note: Report Variables are only available in RDC runtime. If you save a report as a .RPT file to use with standalone Crystal Reports, you will lose the capability of the report variable.
For further information on Report Variables, see the Report Variables sample application in the \\SeagateSoftware\Crystal Reports\Samples\Code\Visual Basic\Report Variables folder. For a description of the sample application, see Report Variables.
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |